# include <stdio.h>
# include <stdlib.h>
# include <unistd.h>
# include <time.h>
# include <math.h>

int main(int argc, char *argv[])
{
                int N = 100000000;
                int n = 0,i;
                float x, y;

                srand(time( NULL ));

                for(i = 0; i < N; i++)
                {
                                x = (float) rand() / RAND_MAX;
                                y = (float) rand() / RAND_MAX;

                               if(sqrt (x*x+y*y) <= 1)
                               {
                                               n++;
                               }
                }

                double resultado = (((float)4 * (float)n) / (float)N);
                printf("PI e igual a: %g", resultado);

                return 0;
}
